<template>
  <div class="dialog" v-show="isShow">
    <div class="content">
      <div class="title" v-html="title"></div>
      <div class="sub-title" v-html="subTitle"></div>
      <div class="footer">
        <div class="cancel" @click.stop="emits('cancel')">{{ cancelText }}</div>
        <div class="confirm" @click.stop="emits('confirm')">{{ confirmText }}</div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
interface Props {
  isShow: boolean;
  title: string;
  subTitle: string;
  cancelText: string;
  confirmText: string;
}
const props = withDefaults(defineProps<Props>(), {
  isShow: false,
  cancelText: '取消',
  confirmText: '确定',
  title: '',
  subTitle: '',
});
interface Emits {
  (e: 'cancel'): void;
  (e: 'confirm'): void;
}
const emits = defineEmits<Emits>();
</script>

<style scoped lang="less">
.dialog {
  position: fixed;
  display: flex;
  justify-content: center;
  align-items: center;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  .content {
    width: 560px;
    height: 278px;
    border-radius: 8px;
    background-color: var(--bg-color-4);
    z-index: 1000;
    .title {
      text-align: center;
      color: var(--text-3);
      font-family: PingFang SC;
      font-weight: bold;
      font-size: 36px;
      margin-top: 40px;
    }
    .sub-title {
      text-align: center;
      color: var(--text-2);
      font-family: PingFang SC;
      font-size: 28px;
      margin-top: 12px;
      padding-bottom: 30px;
      border-bottom: 1px solid var(--text-5);
      /deep/.bold {
        font-weight: 500;
        color: var(--text-3);
      }
    }
    .footer {
      display: flex;
      justify-content: space-between;
      width: 100%;
      height: 100px;
      .cancel {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 50%;
        text-align: center;
        color: var(--text-3);
        font-family: PingFang SC;
        font-size: 34px;
        line-height: 36px;
      }
      .confirm {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 50%;
        text-align: center;
        color: rgba(233, 48, 48, 1);
        font-family: PingFang SC;
        font-size: 34px;
        line-height: 42px;
        border-left: 1px solid var(--text-5);
      }
    }
  }
}
</style>
